import React, { Component } from 'react'
import {Link, NavLink} from 'react-router-dom'

export default class NotFound extends Component {
  constructor() {
    super();
    this.state = {}
  }
  changePage(url) {
    console.log(this.props);
    this.props.history.push(url+'?age=20&name=Tom');
    // go(整数)
    // goBack()
    // goForward()
    // replace(url)
  }
  render() {
    return (
      <div>
        <p>您输入的地址有误！</p>
        <Link to="/">返回首页</Link>
        <br />
        {/* Link和NavLink的区别：NavLink可以添加激活时的效果 */}
        <NavLink to="/params?age=18&name=jack" activeClassName="act666">参数页</NavLink>
        <br />
        <NavLink to="/login" activeClassName="act666">登录页</NavLink>
        <br />
        <NavLink to="/reg" activeClassName="act666">注册页</NavLink>
        <br />
        <hr />
        <button onClick={()=>this.changePage('/params')}>参数页</button>
        <button onClick={()=>this.changePage('/')}>首页</button>
        <button onClick={()=>this.changePage('/login')}>登录页</button>
        <button onClick={()=>this.changePage('/reg')}>注册页</button>
      </div>
    )
  }
}
